package test11;

import java.io.IOException;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: YKH
 * Date: 2022-11-07
 * Time: 9:49
 */
public class Test03 {
    public static void main(String[] args) throws IOException {
        String str;
        char ch,temp;
        int n= 0;
        Scanner buf = new Scanner(System.in);
        System.out.println("输入字符流");
        str = buf.nextLine();
        System.out.println("输入待查找的字符");
        ch = (char) System.in.read();
        for(int i=0;i<str.length();i++ ) {
            temp=str.charAt(i);
            if( temp ==ch) {
                n++;
            }
        }
        System.out.println("字符串"+str+"中字符"+ch + "个数为: "+n);
    }
}
